package cn.shengongying.enums;

import cn.shengongying.exception.ParamException;

import java.util.Arrays;

/**
 * author: RXK
 * date: 2022/1/10 星期一
 * desc:
 */
public enum PayEnum {
    wechat,
    Ali;

    public static PayEnum type(Integer payType) {
        return Arrays.stream(PayEnum.values())
                .filter(payEnum -> payEnum.ordinal() == payType)
                .findFirst()
                .orElseThrow(() -> new ParamException(ResponseCodeEnum.param_exception));
    }
}
